//<![CDATA[

// css helper
(function($) {
    var data = [
        {str:navigator.userAgent,sub:'Chrome',ver:'Chrome',name:'chrome'},
        {str:navigator.vendor,sub:'Apple',ver:'Version',name:'safari'},
        {prop:window.opera,ver:'Opera',name:'opera'},
        {str:navigator.userAgent,sub:'Firefox',ver:'Firefox',name:'firefox'},
        {str:navigator.userAgent,sub:'MSIE',ver:'MSIE',name:'ie'}];
    for (var n=0;n<data.length;n++)	{
        if ((data[n].str && (data[n].str.indexOf(data[n].sub) != -1)) || data[n].prop) {
            var v = function(s){var i=s.indexOf(data[n].ver);return (i!=-1)?parseInt(s.substring(i+data[n].ver.length+1)):'';};
            $('html').addClass(data[n].name+' '+data[n].name+v(navigator.userAgent) || v(navigator.appVersion)); break;			
        }
    }
})(jQuery);
/* end Page */

/* begin Menu */
jQuery(function () {
    if (!jQuery.browser.msie || parseInt(jQuery.browser.version) > 7) return;
    jQuery('ul.yzn-hmenu>li:not(:first-child)').each(function () { jQuery(this).prepend('<span class="yzn-hmenu-separator"> </span>'); });
    if (!jQuery.browser.msie || parseInt(jQuery.browser.version) > 6) return;
    jQuery('ul.yzn-hmenu li').each(function () {
        this.j = jQuery(this);
        this.UL = this.j.children('ul:first');
        if (this.UL.length == 0) return;
        this.A = this.j.children('a:first');
        this.onmouseenter = function () {
            this.j.addClass('yzn-hmenuhover');
            this.UL.addClass('yzn-hmenuhoverUL');
            this.A.addClass('yzn-hmenuhoverA');
        };
        this.onmouseleave = function() {
            this.j.removeClass('yzn-hmenuhover');
            this.UL.removeClass('yzn-hmenuhoverUL');
            this.A.removeClass('yzn-hmenuhoverA');
        };
    });
});

jQuery(function() { setHMenuOpenDirection({container: "div.yzn-sheet-body", defaultContainer: "#yzn-main", menuClass: "yzn-hmenu", leftToRightClass: "yzn-hmenu-left-to-right", rightToLeftClass: "yzn-hmenu-right-to-left"}); });

function setHMenuOpenDirection(menuInfo) {
    var defaultContainer = jQuery(menuInfo.defaultContainer);
    defaultContainer = defaultContainer.length > 0 ? defaultContainer = jQuery(defaultContainer[0]) : null;

    jQuery("ul." + menuInfo.menuClass + ">li>ul").each(function () {
        var submenu = jQuery(this);
        var submenuWidth = submenu.outerWidth();
        var submenuLeft = submenu.offset().left;

        var mainContainer = submenu.parents(menuInfo.container);
        mainContainer = mainContainer.length > 0 ? mainContainer = jQuery(mainContainer[0]) : null;

        var container = mainContainer || defaultContainer;
        if (container != null) {
            var containerLeft = container.offset().left;
            var containerWidth = container.outerWidth();

            if (submenuLeft + submenuWidth >=
                    containerLeft + containerWidth) 
                /* right to left */
                submenu.addClass(menuInfo.rightToLeftClass).find("ul").addClass(menuInfo.rightToLeftClass);
            if (submenuLeft <= containerLeft)
                /* left to right */
                submenu.addClass(menuInfo.leftToRightClass).find("ul").addClass(menuInfo.leftToRightClass);
        }
    });
}
/* end Menu */

/* begin MenuSubItem */
jQuery(function () {
    jQuery("ul.yzn-hmenu ul li").hover(function () { jQuery(this).prev().children("a").addClass("yzn-hmenu-before-hovered"); }, 
        function () { jQuery(this).prev().children("a").removeClass("yzn-hmenu-before-hovered"); });
});

jQuery(function () {
    if (!jQuery.browser.msie) return;
    var ieVersion = parseInt(jQuery.browser.version);
    if (ieVersion > 7) return;

    /* Fix width of submenu items.
    * The width of submenu item calculated incorrectly in IE6-7. IE6 has wider items, IE7 display items like stairs.
    */
    jQuery.each(jQuery("ul.yzn-hmenu ul"), function () {
        var maxSubitemWidth = 0;
        var submenu = jQuery(this);
        var subitem = null;
        jQuery.each(submenu.children("li").children("a"), function () {
            subitem = jQuery(this);
            var subitemWidth = subitem.outerWidth();
            if (maxSubitemWidth < subitemWidth)
                maxSubitemWidth = subitemWidth;
        });
        if (subitem != null) {
            var subitemBorderLeft = parseInt(subitem.css("border-left-width"), 10) || 0;
            var subitemBorderRight = parseInt(subitem.css("border-right-width"), 10) || 0;
            var subitemPaddingLeft = parseInt(subitem.css("padding-left"), 10) || 0;
            var subitemPaddingRight = parseInt(subitem.css("padding-right"), 10) || 0;
            maxSubitemWidth -= subitemBorderLeft + subitemBorderRight + subitemPaddingLeft + subitemPaddingRight;
            submenu.children("li").children("a").css("width", maxSubitemWidth + "px");
        }
    });

    if (ieVersion > 6) return;
    jQuery("ul.yzn-hmenu ul>li:first-child>a").css("border-top-width", "1px");
});
/* end MenuSubItem */

/* begin Layout */
jQuery(function () {
     var c = jQuery('div.yzn-content');
    if (c.length !== 1) return;
    var s = c.parent().children('.yzn-layout-cell:not(.yzn-content)');

    jQuery(window).bind('resize', function () {
        c.css('height', 'auto');
        var innerHeight = 0;
        jQuery('#yzn-main').children().each(function() {innerHeight += jQuery(this).outerHeight(true);});
        var r = jQuery('#yzn-main').height() - innerHeight;
        if (r > 0) c.css('height', r + c.parent().height() + 'px');
    });

    if (jQuery.browser.msie && parseInt(jQuery.browser.version) < 8) {
        jQuery(window).bind('resize', function() {
            var w = 0;
            c.hide();
            s.each(function() { w += this.clientWidth; });
            c.w = c.parent().width(); c.css('width', c.w - w + 'px');
            c.show();
        });
    }

    jQuery(window).trigger('resize');
});/* end Layout */

/* begin Button */
function artButtonSetup(className) {
    jQuery.each(jQuery("a." + className + ", button." + className + ", input." + className), function (i, val) {
        var b = jQuery(val);
        if (!b.parent().hasClass('yzn-button-wrapper')) {
            if (b.is('input')) b.val(b.val().replace(/^\s*/, '')).css('zoom', '1');
            if (!b.hasClass('yzn-button')) b.addClass('yzn-button');
            jQuery("<span class='yzn-button-wrapper'><span class='yzn-button-l'> </span><span class='yzn-button-r'> </span></span>").insertBefore(b).append(b);
            if (b.hasClass('active')) b.parent().addClass('active');
        }
        b.mouseover(function () { jQuery(this).parent().addClass("hover"); });
        b.mouseout(function () { var b = jQuery(this); b.parent().removeClass("hover"); if (!b.hasClass('active')) b.parent().removeClass('active'); });
        b.mousedown(function () { var b = jQuery(this); b.parent().removeClass("hover"); if (!b.hasClass('active')) b.parent().addClass('active'); });
        b.mouseup(function () { var b = jQuery(this); if (!b.hasClass('active')) b.parent().removeClass('active'); });
    });
}
jQuery(function() { artButtonSetup("yzn-button"); });

/* end Button */



function artInsertSidebarBlocks() {
    if (jQuery("body#layout").length > 0) return true;
    jQuery("div.widget").each( function(i, w) {
        if (w.id == 'Navbar1')  return true;
        if (w.id == 'Header1')  return true;
        if (w.id == 'Blog1')    return true;
        
        
        if (w.id == 'LinkList99')    return true;
        if (w.id == 'LinkList98')    return true;
        if (w.id == 'LinkList97')    return true;
        if (w.id == 'PageList98')    return true;
        if (w.id == 'PageList99')    return true;
        if (w.id == 'Text99')        return true;
        if (w.id == 'BlogArchive99') return true;
        
        var widget = jQuery(w);
        if ( (widget.hasClass('Gadget') || widget.hasClass('Followers')) && jQuery.browser.opera) {
            return true;
        }
        
        var widgetTitle = jQuery("h2", widget).text();
        jQuery("h2", widget).remove();
        var widgetContent = widget.html();

        if (widgetContent.indexOf('googlesyndication.com') > -1) return true;
        if (widgetContent.indexOf('statcounter.com/counter/counter_xhtml.js') > -1) return true;
        if (widgetContent.indexOf('bravenet.com/counter/code.php') > -1) return true;
                
        var startBlock        = '<div class="yzn-box yzn-block" id="yzn-block-'+w.id+'"><div class="yzn-box-body yzn-block-body">';
        var startBlockHeader  = '<div class="yzn-bar yzn-blockheader"><h3 class="t">';
        var endBlockHeader    = '</h3></div>';
        var startBlockContent = '<div class="yzn-box yzn-blockcontent"><div class="yzn-box-body yzn-blockcontent-body">';
        var endBlockContent   = '</div></div>';
        var endBlock          = '</div></div>';
        
        widgetContent =  startBlockContent + widgetContent + endBlockContent;
        if (widgetTitle && true){
            widgetContent =  startBlockHeader + widgetTitle + endBlockHeader + widgetContent;
        }
        jQuery(widget).html( startBlock + widgetContent + endBlock );
        
        if (widget.hasClass('Subscribe')) {
            widget.css({'position': 'relative', 'z-index': '2'})
        }
        
    });
}
jQuery(function() { artInsertSidebarBlocks(); });


function artCheckNavBar(){
    if (!false) {
        jQuery("#navbar").remove();
    }
}

function artFixFooterMenu(footerText){
    if (jQuery("#LinkList98").length > 0) {
        var widgetText = jQuery("#LinkList98").html();
        jQuery("#LinkList98").html(widgetText.replace("| |", ""));
    } else {
        var el = jQuery("#Text99 > div.widget-content");
        if (el.html() == '\n<br><br>\n') {
           var dt = new Date();
           el.html(footerText.replace("%YEAR%", dt.getFullYear()));
        } else {
            el.html(el.html() + "<br />");
        }
    }
}


function artFixPostHeaders(){
    jQuery("div.yzn-postmetadataheader").each( function(i) {
        if (jQuery("div, h2", this).length == 0) jQuery(this).css("display", "none");
    });
}
jQuery(function() { artFixPostHeaders(); });


function artHeaderWidget(){
    if (showHeader==null||showHeader==false){
        jQuery("#Header1").css("display", "none");
    }
}
jQuery(function() { artHeaderWidget(); });


function artVMenuWidget(){
    if (showVMenu==null||showVMenu==false){
        jQuery("#LinkList97").css("display", "none");
        jQuery("#BlogArchive99").css("display", "none");
        jQuery("#PageList99").css("display", "none");
    }
}
jQuery(function() { artVMenuWidget(); });


function artFixPostFooters(){
    jQuery("div.yzn-postmetadatafooter > div.yzn-postfootericons").each( function(i) {
        if (jQuery("img, a", this).length == 0) jQuery(this).parent("div.yzn-postmetadatafooter").css("display", "none");    
    });
}
jQuery(function() { artFixPostFooters(); });


var showHomePage = false;
function artFixTopCustomMenu(){
    if (jQuery("#LinkList99").length == 0){
        var navSection = jQuery("#navsection");
        if (navSection.length > 0){
            if (showHomePage) {
                if (window.location == homePageLink) 
                    var tmpstr = '<a href="'+homePageLink+'" class="active">';
                else
                    var tmpstr = '<a href="'+homePageLink+'">';
                navSection.html('<div><div class="yzn-nav-outer"><div class="yzn-nav-wrapper"><div class="yzn-nav-inner"><div class="yzn-nav-center"><ul class="yzn-hmenu"><li>'+tmpstr+'<span class="l"></span><span class="r"></span><span class="t">'+homePageName+'</span></a></li></ul></div></div></div></div></div>');
            } else {
                navSection.html('<div><div class="yzn-nav-outer"><div class="yzn-nav-center"></div></div></div>');
            }
        }
    }
    jQuery("#PageList98").hide();
}

function artFixTopPagesMenu(){
    jQuery("#LinkList99").hide();
}


function artDisplayTopMenu(menuitems) {
    var subList1 = jQuery("");
    var subList2 = jQuery("");
    var subList3 = jQuery("");

    for (var i=0; i < menuitems.length; i++) {
        var itemname = menuitems[i][0];
        var itemlink = menuitems[i][1];
        if (itemlink == "http://./") itemlink = "#";
         
        if (itemname.charAt(0) != "-"){
            if (subList3.length != 0){
                jQuery("li:last", subList2).append(subList3);
                subList3 = jQuery("");
            }
            if (subList2.length != 0){
                jQuery("li:last", subList1).append(subList2);
                subList2 = jQuery("");
            }
            if (subList1.length != 0){
                jQuery("ul.yzn-hmenu li:last").append(subList1);
                subList1 = jQuery("");
            }
            if (window.location == itemlink) 
                jQuery("ul.yzn-hmenu").append('<li><a href="'+itemlink+'" class="active"><span class="l"></span><span class="r"></span><span class="t">'+itemname+'</span></a></li>');
            else
                jQuery("ul.yzn-hmenu").append('<li><a href="'+itemlink+'"><span class="l"></span><span class="r"></span><span class="t">'+itemname+'</span></a></li>');
        } else {
            if (itemname.charAt(2) == "-"){
                if (subList3.length == 0 ) subList3 = jQuery("<ul></ul>");
                subList3.append('<li><a href="'+itemlink+'">'+itemname.substr(3,itemname.length)+'</a></li>');
            } else if (itemname.charAt(1) == "-"){
                if (subList3.length != 0){
                    jQuery("li:last", subList2).append(subList3);
                    subList3 = jQuery("");
                }
                if (subList2.length == 0 ) subList2 = jQuery("<ul></ul>");
                subList2.append('<li><a href="'+itemlink+'">'+itemname.substr(2,itemname.length)+'</a></li>');
            } else if (itemname.charAt(0) == "-"){
                if (subList3.length != 0){
                    jQuery("li:last", subList2).append(subList3);
                    subList3 = jQuery("");
                }
                if (subList2.length != 0){
                    jQuery("li:last", subList1).append(subList2);
                    subList2 = jQuery("");
                }
                if (subList1.length == 0 ) subList1 = jQuery("<ul></ul>");
                subList1.append('<li><a href="'+itemlink+'">'+itemname.substr(1,itemname.length)+'</a></li>');
            }
        }
    }
    if (subList3.length != 0){
        jQuery("li:last", subList2).append(subList3);
        subList3 = jQuery("");
    }
    if (subList2.length != 0){
        jQuery("li:last", subList1).append(subList2);
        subList2 = jQuery("");
    }
    if (subList1.length != 0){
        jQuery("ul.yzn-hmenu li:last").append(subList1);
        subList1 = jQuery("");
    }
}


function artDisplayVMenu(vmenuitems) {

    if (jQuery("ul.yzn-vmenu").children().length > 0) return true;

    var subList1 = jQuery("");
    var subList2 = jQuery("");
    var subList3 = jQuery("");

    for (var i=0; i < vmenuitems.length; i++) {
        var itemname = vmenuitems[i][0];
        var itemlink = vmenuitems[i][1];
        if (itemlink == "http://./") itemlink = "#";
         
        if (itemname.charAt(0) != "-"){
            if (subList3.length != 0){
                jQuery("li:last", subList2).append(subList3);
                subList3 = jQuery("");
            }
            if (subList2.length != 0){
                jQuery("li:last", subList1).append(subList2);
                subList2 = jQuery("");
            }
            if (subList1.length != 0){
                jQuery("ul.yzn-vmenu li:last").append(subList1);
                subList1 = jQuery("");
            }
            if (window.location == itemlink) 
                jQuery("ul.yzn-vmenu").append('<li><a href="'+itemlink+'" class="active"><span class="l"></span><span class="r"></span><span class="t">'+itemname+'</span></a></li>');
            else
                jQuery("ul.yzn-vmenu").append('<li><a href="'+itemlink+'"><span class="l"></span><span class="r"></span><span class="t">'+itemname+'</span></a></li>');
        } else {
            if (itemname.charAt(2) == "-"){
                if (subList3.length == 0 ) subList3 = jQuery("<ul></ul>");
                if (window.location == itemlink)
                    subList3.append('<li><a href="'+itemlink+'" class="active">'+itemname.substr(3,itemname.length)+'</a></li>');
                else
                    subList3.append('<li><a href="'+itemlink+'">'+itemname.substr(3,itemname.length)+'</a></li>');
            } else if (itemname.charAt(1) == "-"){
                if (subList3.length != 0){
                    jQuery("li:last", subList2).append(subList3);
                    subList3 = jQuery("");
                }
                if (subList2.length == 0 ) subList2 = jQuery("<ul></ul>");
                if (window.location == itemlink)
                    subList2.append('<li><a href="'+itemlink+'" class="active">'+itemname.substr(2,itemname.length)+'</a></li>');
                else
                    subList2.append('<li><a href="'+itemlink+'">'+itemname.substr(2,itemname.length)+'</a></li>');
            } else if (itemname.charAt(0) == "-"){
                if (subList3.length != 0){
                    jQuery("li:last", subList2).append(subList3);
                    subList3 = jQuery("");
                }
                if (subList2.length != 0){
                    jQuery("li:last", subList1).append(subList2);
                    subList2 = jQuery("");
                }
                if (subList1.length == 0 ) subList1 = jQuery("<ul></ul>");
                if (window.location == itemlink)
                    subList1.append('<li><a href="'+itemlink+'" class="active">'+itemname.substr(1,itemname.length)+'</a></li>');
                else
                    subList1.append('<li><a href="'+itemlink+'">'+itemname.substr(1,itemname.length)+'</a></li>');
            }
        }
    }
    if (subList3.length != 0){
        jQuery("li:last", subList2).append(subList3);
        subList3 = jQuery("");
    }
    if (subList2.length != 0){
        jQuery("li:last", subList1).append(subList2);
        subList2 = jQuery("");
    }
    if (subList1.length != 0){
        jQuery("ul.yzn-vmenu li:last").append(subList1);
        subList1 = jQuery("");
    }

    if (!false){
        jQuery(".yzn-vmenublockheader").css("display", "none");
    }
    
    var a = jQuery("ul.yzn-vmenu a.active");
    a.parents('ul.yzn-vmenu').find("ul, a").removeClass('active');
    a.parent().children('ul').addClass('active');
    a.parents('ul.yzn-vmenu ul').addClass('active');
    a.parents('ul.yzn-vmenu li').children('a').addClass('active');
    
}


function artFixVMenuArchive(){
    if (jQuery("#yzn-vmenu-archive").length > 0){
        if (!false){
            jQuery(".yzn-vmenublockheader").css("display", "none");
        }
        jQuery("#yzn-vmenu-archive a").each(function(i) {
            if (this.href.replace('#', '') == window.location.href.replace('#', '')) {
                jQuery(this).addClass("active");
            }
        });
        var a = jQuery("#yzn-vmenu-archive a.active");
        a.parents('#yzn-vmenu-archive').find("ul, a").removeClass('active');
        a.parent().children('ul').addClass('active');
        a.parents('#yzn-vmenu-archive ul').addClass('active');
        a.parents('#yzn-vmenu-archive li').children('a').addClass('active');
    }
}


jQuery(function() {
    jQuery(".BlogList").each( function(i) {
        var bl_name = jQuery(this).attr("id");
        jQuery("#" + bl_name + "_show-all").click( function() {
            jQuery("#" + bl_name + "_blogs li").each( function(i) {
                if ( jQuery(this).css("display") == "none") {
                    jQuery(this).css("display", "block");
                    jQuery(this).attr("class", bl_name + "_blogs_hidden");
                    jQuery("#" + bl_name + "_show-all").css("display", "none");
                    jQuery("#" + bl_name + "_show-n").css("display", "block");
                }
            });
        });
        jQuery("#" + bl_name + "_show-n").click(function() {
            jQuery("li." + bl_name + "_blogs_hidden").each( function(i) {
                jQuery(this).css("display", "none");
                jQuery(this).attr("class", "");
                jQuery("#" + bl_name + "_show-all").css("display", "block");
                jQuery("#" + bl_name + "_show-n").css("display", "none");
            });
        });
    });
});


function artFixNavbarPadding(){
    if (jQuery("#navbar").length > 0){
        jQuery("#yzn-main").css('margin-top','30px');
        jQuery("#navbar").css('margin-top','-30px');
        // body bg position
        var bgPosition = jQuery("body").css('background-position');
        if(typeof(bgPosition) === 'undefined') {
            jQuery("body").css('background-position-y', '30px');
        } else {
            bgPosition = bgPosition.replace(' 0%', ' 30px');
            jQuery("body").css('background-position', bgPosition);
        }
    }
}

      //]]>